<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Linux命令," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut命令用来显示行中的指定部分，删除文件中指定字段。cut经常用来显示文件的内容，类似于下的type命令。 1. 命令格式1cut [参数] [file] 2. 命令功能&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut 命令从文件的每一行剪切字节、">
<meta name="keywords" content="Linux命令">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux 命令- cut">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/64. Linux 命令- cut/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut命令用来显示行中的指定部分，删除文件中指定字段。cut经常用来显示文件的内容，类似于下的type命令。 1. 命令格式1cut [参数] [file] 2. 命令功能&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut 命令从文件的每一行剪切字节、">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-09-01T08:37:42.160Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux 命令- cut">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut命令用来显示行中的指定部分，删除文件中指定字段。cut经常用来显示文件的内容，类似于下的type命令。 1. 命令格式1cut [参数] [file] 2. 命令功能&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cut 命令从文件的每一行剪切字节、">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/64. Linux 命令- cut/"/>





  <title>Linux 命令- cut | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/64. Linux 命令- cut/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Linux 命令- cut</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T01:57:34+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cut命令用来显示行中的指定部分，删除文件中指定字段。cut经常用来显示文件的内容，类似于下的type命令。</p>
<h2 id="1-命令格式"><a href="#1-命令格式" class="headerlink" title="1. 命令格式"></a>1. 命令格式</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut [参数] [file]</div></pre></td></tr></table></figure>
<h2 id="2-命令功能"><a href="#2-命令功能" class="headerlink" title="2. 命令功能"></a>2. 命令功能</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cut 命令从文件的每一行剪切字节、字符和字段并将这些字节、字符和字段写至标准输出。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果不指定 File 参数，cut 命令将读取标准输入。必须指定 -b、-c 或 -f 标志之一。</p>
<h2 id="3-命令参数"><a href="#3-命令参数" class="headerlink" title="3. 命令参数"></a>3. 命令参数</h2><ul>
<li>-b：仅显示行中指定直接范围的内容；</li>
<li>-c：仅显示行中指定范围的字符；</li>
<li>-d：指定字段的分隔符，默认的字段分隔符为“TAB”；</li>
<li>-f：显示指定字段的内容；</li>
<li>-n：与“-b”选项连用，不分割多字节字符；</li>
<li>–complement：补足被选择的字节、字符或字段； </li>
<li>–out-delimiter=&lt;字段分隔符&gt;：指定输出内容是的字段分割符；</li>
<li>–help：显示指令的帮助信息</li>
<li>–version：显示指令的版本信息。</li>
</ul>
<h2 id="4-使用实例"><a href="#4-使用实例" class="headerlink" title="4. 使用实例"></a>4. 使用实例</h2><h3 id="实例1：截取文件其中一个字符"><a href="#实例1：截取文件其中一个字符" class="headerlink" title="实例1：截取文件其中一个字符"></a>实例1：截取文件其中一个字符</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut -c2 /etc/passwd</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cut -c2 /etc/passwd</span></div><div class="line">o</div><div class="line">i</div><div class="line">a</div><div class="line">d</div><div class="line">p</div><div class="line">y</div><div class="line">h</div><div class="line">a</div><div class="line">a</div><div class="line">p</div><div class="line">a</div><div class="line">t</div><div class="line">o</div><div class="line">y</div><div class="line">y</div><div class="line">b</div><div class="line">o</div><div class="line">s</div><div class="line">o</div><div class="line">s</div><div class="line">h</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;提取第2个字符</p>
<h3 id="实例2：截取文件多个字符"><a href="#实例2：截取文件多个字符" class="headerlink" title="实例2：截取文件多个字符"></a>实例2：截取文件多个字符</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut -c2-5,10 /etc/passwd</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cut -c2-5,10 /etc/passwd</span></div><div class="line">oot:0</div><div class="line"><span class="keyword">in</span>:x:</div><div class="line">aemo2</div><div class="line">dm:x:</div><div class="line">p:x:l</div><div class="line">ync:0</div><div class="line">hutdx</div><div class="line">alt:0</div><div class="line">ail:1</div><div class="line">perax</div><div class="line">ames2</div><div class="line">tp:x5</div><div class="line">obod9</div><div class="line">ysteu</div><div class="line">ystee</div><div class="line">bus::</div><div class="line">olki:</div><div class="line">ss:x5</div><div class="line">ostf:</div><div class="line">shd::</div><div class="line">hron9</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;提取第2、第3、第4、第5和第10个字符</p>
<h3 id="实例3：提取前4个字符"><a href="#实例3：提取前4个字符" class="headerlink" title="实例3：提取前4个字符"></a>实例3：提取前4个字符</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut -c-4 /etc/passwd</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cut -c-4 /etc/passwd</span></div><div class="line">root</div><div class="line">bin:</div><div class="line">daem</div><div class="line">adm:</div><div class="line">lp:x</div><div class="line">sync</div><div class="line">shut</div><div class="line">halt</div><div class="line">mail</div><div class="line">oper</div><div class="line">game</div><div class="line">ftp:</div><div class="line">nobo</div><div class="line">syst</div><div class="line">syst</div><div class="line">dbus</div><div class="line">polk</div><div class="line">tss:</div><div class="line">post</div><div class="line">sshd</div><div class="line">chro</div></pre></td></tr></table></figure>
<h3 id="实例4：打印从第10个字符开始到结尾"><a href="#实例4：打印从第10个字符开始到结尾" class="headerlink" title="实例4：打印从第10个字符开始到结尾"></a>实例4：打印从第10个字符开始到结尾</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut -c10- /etc/passwd</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cut -c5- /etc/passwd</span></div><div class="line">:x:0:0:root:/root:/bin/bash</div><div class="line">x:1:1:bin:/bin:/sbin/nologin</div><div class="line">on:x:2:2:daemon:/sbin:/sbin/nologin</div><div class="line">x:3:4:adm:/var/adm:/sbin/nologin</div><div class="line">:4:7:lp:/var/spool/lpd:/sbin/nologin</div><div class="line">:x:5:0:sync:/sbin:/bin/sync</div><div class="line">down:x:6:0:shutdown:/sbin:/sbin/shutdown</div><div class="line">:x:7:0:halt:/sbin:/sbin/halt</div><div class="line">:x:8:12:mail:/var/spool/mail:/sbin/nologin</div><div class="line">ator:x:11:0:operator:/root:/sbin/nologin</div><div class="line">s:x:12:100:games:/usr/games:/sbin/nologin</div><div class="line">x:14:50:FTP User:/var/ftp:/sbin/nologin</div><div class="line">dy:x:99:99:Nobody:/:/sbin/nologin</div><div class="line">emd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin</div><div class="line">emd-network:x:192:192:systemd Network Management:/:/sbin/nologin</div><div class="line">:x:81:81:System message bus:/:/sbin/nologin</div><div class="line">itd:x:998:996:User <span class="keyword">for</span> polkitd:/:/sbin/nologin</div><div class="line">x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin</div><div class="line">fix:x:89:89::/var/spool/postfix:/sbin/nologin</div><div class="line">:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin</div><div class="line">ny:x:997:995::/var/lib/chrony:/sbin/nologin</div></pre></td></tr></table></figure>
<h3 id="实例5：用-f-提取指定字段，-d-指定分隔符"><a href="#实例5：用-f-提取指定字段，-d-指定分隔符" class="headerlink" title="实例5：用 -f 提取指定字段，-d 指定分隔符"></a>实例5：用 -f 提取指定字段，-d 指定分隔符</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">cut -f1 -d<span class="string">" "</span> test.txt</div><div class="line">cut -f2,3 -d<span class="string">" "</span> test.txt</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cat test.txt</span></div><div class="line">No Name Mark Percent</div><div class="line">01 tom 69 91</div><div class="line">02 jack 71 87</div><div class="line">03 alex 68 98</div><div class="line">[root@localhost ~]<span class="comment"># cut -f1 -d" " test.txt</span></div><div class="line">No</div><div class="line">01</div><div class="line">02</div><div class="line">03</div><div class="line">[root@localhost ~]<span class="comment"># cut -f2,3 -d" " test.txt</span></div><div class="line">Name Mark</div><div class="line">tom 69</div><div class="line">jack 71</div><div class="line">alex 68</div></pre></td></tr></table></figure>
<h3 id="实例6：使用-–complement-提取指定字段之外的列"><a href="#实例6：使用-–complement-提取指定字段之外的列" class="headerlink" title="实例6：使用 –complement 提取指定字段之外的列"></a>实例6：使用 –complement 提取指定字段之外的列</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cut -f2 -d<span class="string">" "</span> --complement test.txt</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cat test.txt                 </span></div><div class="line">No Name Mark Percent</div><div class="line">01 tom 69 91</div><div class="line">02 jack 71 87</div><div class="line">03 alex 68 98</div><div class="line">[root@localhost ~]<span class="comment"># cut -f2 -d" " --complement test.txt</span></div><div class="line">No Mark Percent</div><div class="line">01 69 91</div><div class="line">02 71 87</div><div class="line">03 68 98</div></pre></td></tr></table></figure>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux命令/" rel="tag"># Linux命令</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/5. Linux 命令-rmdir/" rel="next" title="Linux 命令- rmdir">
                <i class="fa fa-chevron-left"></i> Linux 命令- rmdir
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/17. Linux 命令- whereis/" rel="prev" title="Linux 命令- whereis">
                Linux 命令- whereis <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-命令格式"><span class="nav-number">1.</span> <span class="nav-text">1. 命令格式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-命令功能"><span class="nav-number">2.</span> <span class="nav-text">2. 命令功能</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-命令参数"><span class="nav-number">3.</span> <span class="nav-text">3. 命令参数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-使用实例"><span class="nav-number">4.</span> <span class="nav-text">4. 使用实例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#实例1：截取文件其中一个字符"><span class="nav-number">4.1.</span> <span class="nav-text">实例1：截取文件其中一个字符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例2：截取文件多个字符"><span class="nav-number">4.2.</span> <span class="nav-text">实例2：截取文件多个字符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例3：提取前4个字符"><span class="nav-number">4.3.</span> <span class="nav-text">实例3：提取前4个字符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例4：打印从第10个字符开始到结尾"><span class="nav-number">4.4.</span> <span class="nav-text">实例4：打印从第10个字符开始到结尾</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例5：用-f-提取指定字段，-d-指定分隔符"><span class="nav-number">4.5.</span> <span class="nav-text">实例5：用 -f 提取指定字段，-d 指定分隔符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例6：使用-–complement-提取指定字段之外的列"><span class="nav-number">4.6.</span> <span class="nav-text">实例6：使用 –complement 提取指定字段之外的列</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
